<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>4-02 渲染图片DOM版</title>
  <style>
    #dogImg {
      display: none;
    }
  </style>
</head>
<body>
  <img src="../images/dog.jpg" id="dogImg"/>
  <canvas id="c" width="500" height="500" style="border: 1px solid #ccc;"></canvas>

  <script>
    const context = document.getElementById('c')
    const ctx = context.getContext('2d')

    const image = document.getElementById('dogImg')

    ctx.drawImage(image, 70, 70)
  </script>
</body>
</html>